<extend name="Public/publicHTML"/>

<block name="content">
<link rel="stylesheet" href="__COMMON__/bootstrap/css/bootstrap.min.css" />
<link rel="stylesheet"
	href="__COMMON__/bootstrap/css/font-awesome.min.css" />
<section class="content">
       <div class="row">
       		<div class="col-xs-12">
	       		<div class="box">
	             <div class="box-header">
	               	<nav class="navbar navbar-default">	     
				        <div class="collapse navbar-collapse">
						   <div class="navbar-form row">
				            	<div class="col-md-1">
									<button class="btn bg-navy" type="button" onclick="tree_open(this);"><i class="fa fa-angle-double-down"></i>展开</button>
					            </div>
				            </div>
				      	</div>
	    			</nav> 	               
	             </div><!-- /.box-header -->
	           <div class="box-body">
	           <div class="row">
	            <div class="col-sm-12">
	              <table id="list-table" class="table table-bordered table-striped dataTable" role="grid" aria-describedby="example1_info">
	                 <thead>
	                   <tr role="row">
	                   	<td class="text-left"><!--<input type="checkbox"
										onclick="$('input[name*=\'mail_area\']').prop('checked', this.checked);">全选--><input type="checkbox" id="checkAll" onclick="checkAll(this)">全选</td>
		                   <th valign="middle">地区名称</th>
		                   <th valign="middle">操作</th>
	                   </tr>
	                 </thead>
					 <tbody id="areaList">
						<if condition="!empty($area['area'])">
							<foreach name="area['area']" item="vo" key="k" >
			  					<tr role="row" align="center" class="{$vo.level} allArea" id="{$vo.level}_{$vo.id}"
			  						<if condition="$vo[level] gt 0">style="display:none"</if>>
			  						<td class="text-left">
				  						<input type="checkbox" pId="{$vo[$model::$parentid_d]}"
				  							   onclick="<if condition="isset($vo['hasSon']) &&  $vo['hasSon'] == 1">Condition.checkArea(this)<else/>Condition.checkChildrenArea(this)</if>"
				  			 				class="<if condition="isset($vo['hasSon']) &&  $vo['hasSon'] == 1">father<else/>children</if>"
											name="{$areaModel::$mailArea_d}[]" value="{$vo[$model::$id_d]}" />
									</td>
	                     			<td align="left" style="padding-left:<php> echo ($vo['level'] * 5); </php>em"> 
	                      				<if condition="isset($vo['hasSon']) &&  $vo['hasSon'] == 1">
		                   					<span class="glyphicon glyphicon-plus btn-warning" style="padding:2px; font-size:12px;"  id="icon_{$vo.level}_{$vo[$model::$id_d]}" aria-hidden="false" onclick="rowClicked(this)" ></span>&nbsp;				    
					      				</if>
                             			<span>{$vo[$model::$name_d]}</span>
			     		 			</td>
	                     			<td>
	                     				<a href="javascript:void(0)"onclick="javascript:$(this).parent().parent().remove();">删除</a>
			     					</td>
	                   			</tr>
	                  		</foreach>
	                  	</if>
                   </tbody>
	               </table></div></div>
		           <div class="row">
						<div class="text-left col-sm-10">{$area.page}</div>
						<div class="text-right col-sm-2">
							<a href="javascript:void(0)" style="margin: 20px 0;"
								onclick="SearchGoods.selectGoods('areaList','btn-info');" class="btn btn-info">确定</a>
						</div>
					</div>
	             </div><!-- /.box-body -->
	           </div><!-- /.box -->
       		</div>
       </div>
     </section>
     <script type="text/javascript"> 
     function checkAll(a){
      var arrayChecks = document.getElementsByName("{$areaModel::$mailArea_d}[]"); 
     for(var i=0;i<arrayChecks.length;i++) { 
     	arrayChecks[i].checked = a.checked;
     	 } 
     	}
     </script>
<script type="text/javascript" src="__COMMON__/js/alert.js"></script>
<script type="text/javascript" src="__JS__/goods/goodsClass.js"></script>
<script type="text/javascript" src="__JS__/promation/searchGoods.js"></script>
<script type="text/javascript" src="__JS__/region/condition.js"></script>
</block>